package com.xy.designPatterns.factoryMethod;

import java.util.Objects;

public class PaymentProcessorFactory {

    public PaymentProcessor createProcessor(int type) {
        if (Objects.equals(type, 1)) {
            return new AlipayProcessor();
        } else if (Objects.equals(type, 2)) {
            return new WechatPayProcessor();
        } else {
            throw new IllegalArgumentException();
        }
    }
}
